﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using System.Configuration;
using Ext.Net;
namespace TCDC_System.UserControl
{
    public partial class UserAdd : System.Web.UI.UserControl
    {
        private tcdc_mst_user obj;

        protected void Page_Load(object sender, EventArgs e)
        {
            obj = new tcdc_mst_user();
            obj.strConn = ConfigurationManager.AppSettings["ConnString"];
        }

        public void Show()
        {
            WindowUserAdd.Show();
        }

        protected void SaveUser(object sender, DirectEventArgs e)
        {
            obj.user_type_id = Convert.ToInt32(txt_user_type_id.Text);
            obj.username = txt_username.Text;
            obj.password = txt_password.Text;
            obj.fname_th = txt_fname_th.Text;
            obj.lname_th = txt_lname_th.Text;
            obj.fname_en = txt_fname_en.Text;
            obj.lname_en = txt_lname_en.Text;
            obj.id_card = txt_id_card.Text;
            obj.birth_date = txt_birth_date.Text;
            obj.face_image = txt_face_image.Text;
            obj.gender = txt_gender.Text;
            obj.telephone = txt_telephone.Text;
            obj.mobile = txt_mobile.Text;
            obj.role = txt_role.Text;
            obj.lang = txt_lang.Text;
            obj.create_date = txt_create_date.Text;
            obj.create_by = Convert.ToInt32(txt_create_by.Text);
            obj.update_date = txt_update_date.Text;
            obj.update_by = Convert.ToInt32(txt_update_by.Text);
            obj.site_id = Convert.ToInt32(txt_site_id.Text);
            obj.insertData(obj);
            GridStore.DataSource = obj.getByObject(new tcdc_mst_user());
            GridStore.DataBind();
            FormPanel1.Reset();
            WindowUserAdd.Hide();
        }
        public Store GridStore { get; set; }
    }
}

